import socket, traceback, sys,re
import time, requests
from datetime import datetime
from jsonschema import validate
from common.b_yamlOperate import YamlRead, pathConf


def choiseHeadersHost(url,headers=None):
    """
    根据uri选择请求头里面的Host,修改headers里面的Host
    :param: headers 请求头
    """
    domainstr = re.findall(r'//[0-9A-Za-z\-.]+', url)[0]
    domain = domainstr[2:]
    print(domainstr)
    if headers != None:
        headers['Host'] = domain
        return headers

if __name__ == "__main__":
    pass
    choiseHeadersHost(url="http://120.26.167.7:8113/front/p/mallHome/main")
